import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import viteCompression from "vite-plugin-compression";
import legacy from "@vitejs/plugin-legacy";

// https://vitejs.dev/config/
export default defineConfig({
    base: "/",
    resolve: {
        alias: {
            "@": "/src"
        }
    },
    server: {
        host: "0.0.0.0"
    },
    plugins: [
        vue(),
        legacy({
            targets: ["defaults", "not IE 11"]
        }),
        viteCompression({
            verbose: false, // 不显示gzip压缩信息
            threshold: 1024 * 10 // 10kb
        }),
        Components({
            resolvers: [
                AntDesignVueResolver({
                    importStyle: false
                })
            ]
        })
    ]
});
